<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        setTimeout(function () {
            console.log(1)
        }, 0);
        new Promise(function (resolve, reject) {
            console.log(2)
            for (var i = 0; i < 10000; i++) {
                if (i === 10) { console.log(10) }
                i == 9999 && resolve();
            }
            console.log(3)
        }).then(function () {
            console.log(4)
        })
        console.log(5)
        //同步代码> promise.then>settimeout

        //2  10  3  5  4 1
    </script>
</body>

</html>